package com.ljx.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 商品表
 * @TableName g_goods
 */
@TableName(value ="g_goods")
@Data
@ApiModel("商品信息表")
public class Goods implements Serializable {
    /**
     * 商品主键
     */
    @TableId(type = IdType.AUTO)
    @ApiModelProperty(name = "id",value = "商品主键", dataType = "String")
    private Integer id;

    /**
     * 商品名称
     */
    @ApiModelProperty(name = "gname",value = "商品名称", dataType = "String")
    private String gname;

    /**
     * 商品图片
     */
    @ApiModelProperty(name = "img",value = "商品图片", dataType = "String")
    private String img;

    /**
     * 商品描述
     */
    @ApiModelProperty(name = "remark",value = "商品描述", dataType = "String")
    private String remark;

    /**
     * 商品品牌
     */
    @ApiModelProperty(name = "brandid",value = "商品品牌", dataType = "Integer")
    private Integer brandid;

    /**
     * 商品类别
     */
    @ApiModelProperty(name = "sortid",value = "商品类别", dataType = "Integer")
    private Integer sortid;

    /**
     * 储藏方式
     */
    @ApiModelProperty(name = "depositid",value = "储藏方式", dataType = "Integer")
    private Integer depositid;

    /**
     * 商品单位
     */
    @ApiModelProperty(name = "unitid",value = "商品单位", dataType = "Integer")
    private Integer unitid;

    /**
     * 上架时间
     */
    @ApiModelProperty(name = "addtime",value = "上架时间", dataType = "Date")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date addtime;

    /**
     * 保质期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @ApiModelProperty(name = "保质期",value = "expirationtime", dataType = "Date")
    private Date expirationtime;

    /**
     * 商品状态0审核通过 1驳回 2待审核
     */
    @ApiModelProperty(name = "state",value = "商品状态0审核通过 1驳回 2待审核", dataType = "Integer")
    private Integer state;

    /**
     * 上下架 0上架 1下架
     */
    @ApiModelProperty(name = "status",value = "上下架 0上架 1下架", dataType = "Integer")
    private Integer status;

    /**
     * 商家id
     */
    @ApiModelProperty(name = "bid",value = "商家id", dataType = "String")
    private String bid;

    /**
     * 价格
     */
    @ApiModelProperty(name = "price",value = "价格", dataType = "String")
    private String price;

    /**
     * 逻辑删除
     */
    @TableField(exist = false)
    @ApiModelProperty(name = "isdeleted",value = "逻辑删除", dataType = "Integer")
    private Integer isdeleted;

    /**
     * 驳回理由
     */
    @ApiModelProperty(name = "checkContent",value = "驳回理由", dataType = "String")
    private String checkContent;


    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Goods other = (Goods) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getGname() == null ? other.getGname() == null : this.getGname().equals(other.getGname()))
            && (this.getImg() == null ? other.getImg() == null : this.getImg().equals(other.getImg()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getBrandid() == null ? other.getBrandid() == null : this.getBrandid().equals(other.getBrandid()))
            && (this.getSortid() == null ? other.getSortid() == null : this.getSortid().equals(other.getSortid()))
            && (this.getDepositid() == null ? other.getDepositid() == null : this.getDepositid().equals(other.getDepositid()))
            && (this.getUnitid() == null ? other.getUnitid() == null : this.getUnitid().equals(other.getUnitid()))
            && (this.getAddtime() == null ? other.getAddtime() == null : this.getAddtime().equals(other.getAddtime()))
            && (this.getExpirationtime() == null ? other.getExpirationtime() == null : this.getExpirationtime().equals(other.getExpirationtime()))
            && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getBid() == null ? other.getBid() == null : this.getBid().equals(other.getBid()))
            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
            && (this.getIsdeleted() == null ? other.getIsdeleted() == null : this.getIsdeleted().equals(other.getIsdeleted()))
            && (this.getCheckContent() == null ? other.getCheckContent() == null : this.getCheckContent().equals(other.getCheckContent()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getGname() == null) ? 0 : getGname().hashCode());
        result = prime * result + ((getImg() == null) ? 0 : getImg().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getBrandid() == null) ? 0 : getBrandid().hashCode());
        result = prime * result + ((getSortid() == null) ? 0 : getSortid().hashCode());
        result = prime * result + ((getDepositid() == null) ? 0 : getDepositid().hashCode());
        result = prime * result + ((getUnitid() == null) ? 0 : getUnitid().hashCode());
        result = prime * result + ((getAddtime() == null) ? 0 : getAddtime().hashCode());
        result = prime * result + ((getExpirationtime() == null) ? 0 : getExpirationtime().hashCode());
        result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getBid() == null) ? 0 : getBid().hashCode());
        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
        result = prime * result + ((getIsdeleted() == null) ? 0 : getIsdeleted().hashCode());
        result = prime * result + ((getCheckContent() == null) ? 0 : getCheckContent().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", gname=").append(gname);
        sb.append(", img=").append(img);
        sb.append(", remark=").append(remark);
        sb.append(", brandid=").append(brandid);
        sb.append(", sortid=").append(sortid);
        sb.append(", depositid=").append(depositid);
        sb.append(", unitid=").append(unitid);
        sb.append(", addtime=").append(addtime);
        sb.append(", expirationtime=").append(expirationtime);
        sb.append(", state=").append(state);
        sb.append(", status=").append(status);
        sb.append(", bid=").append(bid);
        sb.append(", price=").append(price);
        sb.append(", isdeleted=").append(isdeleted);
        sb.append(", checkContent=").append(checkContent);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }


    //联表
    /**
     * 商家信息表
     */
    @TableField(exist = false)
    private BusinessInfo businessInfo;

    /**
     * 品牌表
     */
    @TableField(exist = false)
    private Brand brand;

    /**
     * 商品储藏方式表
     */
    @TableField(exist = false)
    private Deposit deposit;

    /**
     * 商品类别表
     */
    @TableField(exist = false)
    private Sort sort;

    /**
     * 商品计量单位表
     */
    @TableField(exist = false)
    private Unit unit;

    /**
     * 商品存货信息表
     */
    @TableField(exist = false)
    private Stock stock;


    @TableField(exist = false)
    private String unitname;

    @TableField(exist = false)
    private Integer num;

    @TableField(exist = false)
    private Integer totalmoney;

    @TableField(exist = false)
    private Integer commentstatus;

    @TableField(exist = false)
    private String sname;
}